package com.tedu.parkinglot.operation.controller;

import com.tedu.parkinglot.base.response.JsonResult;
import com.tedu.parkinglot.operation.pojo.dto.OperationQuery;
import com.tedu.parkinglot.operation.pojo.vo.OperationVO;
import com.tedu.parkinglot.operation.service.OperationService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Collection;
import java.util.List;

@Slf4j
@RestController
@RequestMapping("/v1/operation")
public class OperationController {
    @Autowired
    OperationService operationService;
    @GetMapping("select")
    public JsonResult selectOperation(OperationQuery operationQuery){
        log.debug("查询操作日志列表:OperationQuery{}",operationQuery);
        List<OperationVO> list = operationService.selectOperation(operationQuery);
        return JsonResult.ok(list);
    }
    @PostMapping("delete/{id}")
    public JsonResult deleteOperation(@PathVariable Long id){
        log.debug("删除操作日志:id{}",id);
        operationService.deleteOperation(id);
        return JsonResult.ok();
    }
}
